package com.santu.edu.supporter.biz.order.common.pojo.enums;

import com.santu.edu.supporter.exception.BizException;
import com.santu.edu.supporter.exception.CustomError;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author luoyaoqi
 * @createTime 2024/2/28
 * @description
 */
@AllArgsConstructor
@Getter
public enum OrderTypeEnum {
    /**
     *
     */
    KUAI_DI(1, "代取快递"),
    WAI_MAI(2, "外卖"),
    HELP_BAY(3, "代买"),
    OTHER(4, "其他");
    ;


    private final Integer code;

    private final String desc;


    public static OrderTypeEnum convert(Integer code) {
        for (OrderTypeEnum e : OrderTypeEnum.values()) {
            if (e.getCode().equals(code)) {
                return e;
            }
        }
        throw BizException.causeBy(CustomError.ENUM_CONVERT_ERROR, "OrderTypeEnum转换异常");
    }
}
